import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
 
public class TomSend implements Runnable {
	DatagramSocket ds =null;
	DatagramPacket dp =null;
	
	public TomSend(DatagramSocket ds) {
		
		this.ds = ds;
	}
 
	@Override
	public void run() {
		BufferedReader br=null;
		try {
			 br =new BufferedReader(new InputStreamReader(System.in));
			String str=null;
			while((str=br.readLine())!=null){
				
				byte[] buf=str.getBytes();
				dp=new DatagramPacket(buf, buf.length, InetAddress.getByName("171.88.73.17"), 9992);//修改成自己的ip地址
				ds.send(dp);
				if("over".equalsIgnoreCase(str)){
					break;
				}
				
			}
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally{
			try {
				br.close();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
}